using System;

namespace OhioState.Graphics.Proxy
{
    /// <summary>
    /// RasterOpsProxy class that implements blending, alpha and depth testing
    /// </summary>
    [Serializable()]
    public class RasterOpsProxy : IRasterOps, System.ICloneable
    {
        #region Public Properties
        /// <summary>
        /// Implementation of IRasterOps Blending accessor
        /// </summary>
        public BlendMode Blending
        {
            get { return _blendMode; }
            set { _blendMode = value; }
        }
        /// <summary>
        /// Implementation of IRasterOps DepthTest accessor
        /// </summary>
        public DepthMode DepthTest
        {
            get { return _depthTest; }
            set { _depthTest = value; }
        }
        /// <summary>
        /// Implementation of IRasterOps AlphaTest accessor
        /// </summary>
        public AlphaMode AlphaTest
        {
            get { return _alphaTest; }
            set { _alphaTest = value; }
        }
        //
        // Stencil Operations
        //
        //TODO: ADD Stencil tests as needed. Try to not mimic OpenGL, but provide higher-level conditions.
        #endregion Public Properties

        #region Constructors
        /// <summary>
        /// Constructor for RasterOpsProxy
        /// </summary>
        public RasterOpsProxy()
        {
            _blendMode = BlendMode.OVER;
            _depthTest = DepthMode.OFF;
            _alphaTest = AlphaMode.OFF;
        }
        #endregion

        #region System.Object Overrides
        /// <summary>
        /// Overrides shared object ToString method
        /// </summary>
        /// <returns>A string representing blendmode, depthtest and alphatest' name</returns>
        public override string ToString()
        {
            return "Blending: " + _blendMode.ToString() + "Depth  Test: " + _depthTest.ToString()
                + "Alpha  Test: " + _alphaTest.ToString();
        }
        #endregion

        #region System.Cloneable
        /// <summary>
        /// Clones a RasterOpsProxy object
        /// </summary>
        /// <returns></returns>
        public Object Clone()
        {
            RasterOpsProxy newRasterOps = new RasterOpsProxy();
            newRasterOps._depthTest = this._depthTest;
            newRasterOps._alphaTest = this._alphaTest;
            newRasterOps._blendMode = this._blendMode;
            return newRasterOps;
        }
        #endregion

        #region Member Variables
        private BlendMode _blendMode;
        private DepthMode _depthTest;
        private AlphaMode _alphaTest;
        #endregion
    }
}
